﻿using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace Service.Model.Map
{
    public class OpeningMap : EntityTypeConfiguration<Opening>
    {
        public OpeningMap()
        {
            ToTable("dbo.Openings");
            HasKey(o => new { o.FEN, o.Move });

            Property(o => o.OpeningId).HasColumnName("OpeningId").IsRequired().HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            Property(o => o.Name).HasColumnName("Name").IsRequired();
            Property(o => o.FEN).HasColumnName("Fen").IsRequired();
            Property(o => o.Move).HasColumnName("Move").IsRequired();
        }
    }
}